﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="HousingType.aspx.cs" Inherits="NEWS.Admin.HousingType" Title="Untitled Page" %>
<asp:Content id="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 
    <script type="text/javascript">

function confirmAction() {
    if(confirm('Bạn có chắc chắn muốn xóa???')) {
        // you clicked the OK button.
        // you can allow the form to post the data.
        return true;
    }
    else 
        // you clicked the Cancel button.
        // you can disallow the form submission.
        return false;
    }
</script>
   <asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
 <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
     <ContentTemplate>
           <asp:Panel ID="PanelDasboard" runat="server"  Visible="true">
            <div class="dashboard">
                <h2 class="ico_mug">
                    Danh sách loại nhà đất
                </h2>
                <div>
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        CellPadding="4" DataKeyNames="HousingTypeID"
                        DataSourceID="ObjectDataSource1" Width="100%" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged" AllowPaging="True" 
                        ForeColor="#333333" GridLines="None">
                        <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                        <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:CommandField ButtonType="Image" SelectImageUrl="~/Admin/img/edit.png" 
                                ShowSelectButton="True" >
                                <ItemStyle Width="50px" />
                            </asp:CommandField>
                            <asp:BoundField DataField="HousingTypeID" HeaderText="Mã nhà đất" ReadOnly="True" 
                                SortExpression="HousingTypeID" InsertVisible="False" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Center" Width="180px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="HousingTypeName" HeaderText="Tên nhà đất" 
                                SortExpression="HousingTypeName" >
                                <HeaderStyle HorizontalAlign="Left" />
                                <ItemStyle HorizontalAlign="Left" Width="300px" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="Kích hoạt">
                                <ItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Eval("IsActive") %>' Enabled="false" />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                        </Columns>
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                        SelectMethod="GetHousingTypeBOList" 
                        TypeName="HousingInfo.Library.HousingTypeBOList">
                    </asp:ObjectDataSource>
                    <asp:Label ID="messagedelete" runat="server" Font-Bold="True" Font-Size="Small" 
                        ForeColor="Red"></asp:Label>
                    <br />
                </div>
            </div>
       </asp:Panel>
    <asp:Panel ID="PanelActions" runat="server"  Visible="false">
    <div class="dashboard">
        <h2 class="ico_mug">
            <asp:Label ID="lbHeaderActions" runat="server" Text="Loại nhà đất"></asp:Label>
        </h2>
       
       
        <div>
            <table style="width: 100%">
                <tr>
                    <td style="width: 132px">
                        &nbsp;</td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:Label ID="message" runat="server" Font-Bold="True" Font-Size="Small" 
                            ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="lblhousingtypeID" runat="server" Text="Mã Loại nhà đất :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txthousingtypeID" runat="server" ReadOnly="True" Width="172px" 
                            Enabled="False"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="Label2" runat="server" Text="Tên Loại nhà đất :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txthousingtypename" runat="server" Width="172px" MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txthousingtypename" ErrorMessage="?"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                            ControlToValidate="txthousingtypename" ErrorMessage="Độ dài tối thiểu &gt; 1 và tối đa là 50" 
                            ValidationExpression="^([\S\s]{2,50})$"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="Label10" runat="server" Text="Kích hoạt :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:CheckBox ID="isActive" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px">
                        &nbsp;</td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td style="width: 132px">
                        &nbsp;</td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:Button ID="btnUpdate" runat="server" Text="Cập nhật" 
                            onclick="btnUpdate_Click" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button ID="btnDelete" runat="server" onclick="btnDelete_Click"  OnClientClick="javascript:return confirmAction();"
                            Text="Xóa" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="Thêm" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
     </asp:Panel>
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
